home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / PInterfaces / Windows.p < prev    next >
Encoding:
Text File  |  1995-08-24  |  13.9 KB  |  523 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Windows.p
  3.  
  4.      Contains:    Window Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1.1 in “MPW Latest” on ETO #19
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Windows;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __WINDOWS__}
  30. {$SETC __WINDOWS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC WindowsIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __MEMORY__}
  43. {$I Memory.p}
  44. {$ENDC}
  45. {    MixedMode.p                                                    }
  46.  
  47. {$IFC UNDEFINED __QUICKDRAW__}
  48. {$I Quickdraw.p}
  49. {$ENDC}
  50. {    QuickdrawText.p                                                }
  51.  
  52. {$IFC UNDEFINED __EVENTS__}
  53. {$I Events.p}
  54. {$ENDC}
  55. {    OSUtils.p                                                    }
  56.  
  57. {$IFC UNDEFINED __CONTROLS__}
  58. {$I Controls.p}
  59. {$ENDC}
  60. {    Menus.p                                                        }
  61.  
  62. {$PUSH}
  63. {$ALIGN MAC68K}
  64. {$LibExport+}
  65.  
  66. CONST
  67.     kWindowDefProcType            = 'WDEF';
  68.  
  69. {####################################################################################}
  70. {}
  71. {    Window Definition ID's}
  72. {}
  73. {####################################################################################}
  74.     kStandardWindowDefinition    = 0;                            { for document windows and dialogs}
  75.     kRoundWindowDefinition        = 1;                            { old da-style window}
  76.     kFloatingWindowDefinition    = 124;                            { for floating windows}
  77.  
  78. {####################################################################################}
  79. {}
  80. { Window Variant Codes}
  81. {}
  82. {####################################################################################}
  83. { for use with kStandardWindowDefinition }
  84.     kModalDialogVariantCode        = 1;
  85.     kMovableModalDialogVariantCode = 5;
  86. { for use with kFloatingWindowDefinition }
  87.     kSideFloaterVariantCode        = 8;
  88.  
  89. {####################################################################################}
  90. {}
  91. { Old-style procIDs.  For use only with New(C)Window}
  92. {}
  93. {####################################################################################}
  94.     documentProc                = 0;
  95.     dBoxProc                    = 1;
  96.     plainDBox                    = 2;
  97.     altDBoxProc                    = 3;
  98.     noGrowDocProc                = 4;
  99.     movableDBoxProc                = 5;
  100.     zoomDocProc                    = 8;
  101.     zoomNoGrow                    = 12;
  102.     rDocProc                    = 16;
  103. { floating window defproc ids }
  104.     floatProc                    = 1985;
  105.     floatGrowProc                = 1987;
  106.     floatZoomProc                = 1989;
  107.     floatZoomGrowProc            = 1991;
  108.     floatSideProc                = 1993;
  109.     floatSideGrowProc            = 1995;
  110.     floatSideZoomProc            = 1997;
  111.     floatSideZoomGrowProc        = 1999;
  112.  
  113. {####################################################################################}
  114. {}
  115. { Standard window kinds}
  116. {}
  117. {####################################################################################}
  118.     dialogKind                    = 2;
  119.     userKind                    = 8;
  120.     kDialogWindowKind            = 2;
  121.     kApplicationWindowKind        = 8;
  122.  
  123. {####################################################################################}
  124. {}
  125. { FindWindow result codes}
  126. {}
  127. {####################################################################################}
  128.     inDesk                        = 0;
  129.     inMenuBar                    = 1;
  130.     inSysWindow                    = 2;
  131.     inContent                    = 3;
  132.     inDrag                        = 4;
  133.     inGrow                        = 5;
  134.     inGoAway                    = 6;
  135.     inZoomIn                    = 7;
  136.     inZoomOut                    = 8;
  137.  
  138.     wDraw                        = 0;
  139.     wHit                        = 1;
  140.     wCalcRgns                    = 2;
  141.     wNew                        = 3;
  142.     wDispose                    = 4;
  143.     wGrow                        = 5;
  144.     wDrawGIcon                    = 6;
  145.  
  146.     deskPatID                    = 16;
  147.  
  148. {####################################################################################}
  149. {}
  150. { Window Definition hit test result codes ("WindowPart")}
  151. {}
  152. {####################################################################################}
  153.     wNoHit                        = 0;
  154.     wInContent                    = 1;
  155.     wInDrag                        = 2;
  156.     wInGrow                        = 3;
  157.     wInGoAway                    = 4;
  158.     wInZoomIn                    = 5;
  159.     wInZoomOut                    = 6;
  160.  
  161. TYPE
  162.     WindowDefProcPtr = ProcPtr;  { FUNCTION WindowDef(varCode: INTEGER; theWindow: WindowRef; message: INTEGER; param: LONGINT): LONGINT; }
  163.     {
  164.         DeskHookProcPtr uses register based parameters on the 68k and cannot
  165.         be written in or called from a high-level language without the help of
  166.         mixed mode or assembly glue.
  167.  
  168.         In:
  169.          => mouseClick      D0.B
  170.          => *theEvent       A0.L
  171.     }
  172.     DeskHookProcPtr = Register68kProcPtr;  { register PROCEDURE DeskHook(mouseClick: BOOLEAN; VAR theEvent: EventRecord); }
  173.     WindowDefUPP = UniversalProcPtr;
  174.     DeskHookUPP = UniversalProcPtr;
  175.  
  176. CONST
  177.     uppWindowDefProcInfo = $00003BB0; { FUNCTION (2 byte param, 4 byte param, 2 byte param, 4 byte param): 4 byte result; }
  178.     uppDeskHookProcInfo = $00130802; { Register PROCEDURE (1 byte in D0, 4 bytes in A0); }
  179.  
  180. FUNCTION NewWindowDefProc(userRoutine: WindowDefProcPtr): WindowDefUPP;
  181.     {$IFC NOT GENERATINGCFM }
  182.     INLINE $2E9F;
  183.     {$ENDC}
  184.  
  185. FUNCTION NewDeskHookProc(userRoutine: DeskHookProcPtr): DeskHookUPP;
  186.     {$IFC NOT GENERATINGCFM }
  187.     INLINE $2E9F;
  188.     {$ENDC}
  189.  
  190. FUNCTION CallWindowDefProc(varCode: INTEGER; theWindow: WindowRef; message: INTEGER; param: LONGINT; userRoutine: WindowDefUPP): LONGINT;
  191.     {$IFC NOT GENERATINGCFM}
  192.     INLINE $205F, $4E90;
  193.     {$ENDC}
  194.  
  195. PROCEDURE CallDeskHookProc(mouseClick: BOOLEAN; VAR theEvent: EventRecord; userRoutine: DeskHookUPP);
  196.     {$IFC NOT GENERATINGCFM}
  197.     {To be implemented:  Glue to move parameters into registers.}
  198.     {$ENDC}
  199. FUNCTION GetGrayRgn : RgnHandle;
  200.     {$IFC NOT CFMSYSTEMCALLS}
  201.     INLINE $2EB8, $09EE;            { MOVE.l $09EE,(SP) }
  202.     {$ENDC}
  203.  
  204. {####################################################################################}
  205. {}
  206. {    Color table defined for compatibility only.  Will move to some ifdef'd wasteland.}
  207. {}
  208. {####################################################################################}
  209.  
  210. TYPE
  211.     WinCTab = RECORD
  212.         wCSeed:                    LONGINT;                                { reserved }
  213.         wCReserved:                INTEGER;                                { reserved }
  214.         ctSize:                    INTEGER;                                { usually 4 for windows }
  215.         ctTable:                ARRAY [0..4] OF ColorSpec;
  216.     END;
  217.  
  218.     WCTabPtr = ^WinCTab;
  219.     WCTabHandle = ^WCTabPtr;
  220.  
  221.  
  222. PROCEDURE InitWindows;
  223.     {$IFC NOT GENERATINGCFM}
  224.     INLINE $A912;
  225.     {$ENDC}
  226. PROCEDURE GetWMgrPort(VAR wPort: GrafPtr);
  227.     {$IFC NOT GENERATINGCFM}
  228.     INLINE $A910;
  229.     {$ENDC}
  230. FUNCTION NewWindow(wStorage: UNIV Ptr; {CONST}VAR boundsRect: Rect; title: ConstStr255Param; visible: BOOLEAN; theProc: INTEGER; behind: WindowRef; goAwayFlag: BOOLEAN; refCon: LONGINT): WindowRef;
  231.     {$IFC NOT GENERATINGCFM}
  232.     INLINE $A913;
  233.     {$ENDC}
  234. FUNCTION GetNewWindow(windowID: INTEGER; wStorage: UNIV Ptr; behind: WindowRef): WindowRef;
  235.     {$IFC NOT GENERATINGCFM}
  236.     INLINE $A9BD;
  237.     {$ENDC}
  238. PROCEDURE CloseWindow(theWindow: WindowRef);
  239.     {$IFC NOT GENERATINGCFM}
  240.     INLINE $A92D;
  241.     {$ENDC}
  242. PROCEDURE DisposeWindow(theWindow: WindowRef);
  243.     {$IFC NOT GENERATINGCFM}
  244.     INLINE $A914;
  245.     {$ENDC}
  246. PROCEDURE GetWTitle(theWindow: WindowRef; VAR title: Str255);
  247.     {$IFC NOT GENERATINGCFM}
  248.     INLINE $A919;
  249.     {$ENDC}
  250. PROCEDURE SelectWindow(theWindow: WindowRef);
  251.     {$IFC NOT GENERATINGCFM}
  252.     INLINE $A91F;
  253.     {$ENDC}
  254. PROCEDURE HideWindow(theWindow: WindowRef);
  255.     {$IFC NOT GENERATINGCFM}
  256.     INLINE $A916;
  257.     {$ENDC}
  258. PROCEDURE ShowWindow(theWindow: WindowRef);
  259.     {$IFC NOT GENERATINGCFM}
  260.     INLINE $A915;
  261.     {$ENDC}
  262. PROCEDURE ShowHide(theWindow: WindowRef; showFlag: BOOLEAN);
  263.     {$IFC NOT GENERATINGCFM}
  264.     INLINE $A908;
  265.     {$ENDC}
  266. PROCEDURE HiliteWindow(theWindow: WindowRef; fHilite: BOOLEAN);
  267.     {$IFC NOT GENERATINGCFM}
  268.     INLINE $A91C;
  269.     {$ENDC}
  270. PROCEDURE BringToFront(theWindow: WindowRef);
  271.     {$IFC NOT GENERATINGCFM}
  272.     INLINE $A920;
  273.     {$ENDC}
  274. PROCEDURE SendBehind(theWindow: WindowRef; behindWindow: WindowRef);
  275.     {$IFC NOT GENERATINGCFM}
  276.     INLINE $A921;
  277.     {$ENDC}
  278. FUNCTION FrontWindow: WindowRef;
  279.     {$IFC NOT GENERATINGCFM}
  280.     INLINE $A924;
  281.     {$ENDC}
  282. PROCEDURE DrawGrowIcon(theWindow: WindowRef);
  283.     {$IFC NOT GENERATINGCFM}
  284.     INLINE $A904;
  285.     {$ENDC}
  286. PROCEDURE MoveWindow(theWindow: WindowRef; hGlobal: INTEGER; vGlobal: INTEGER; front: BOOLEAN);
  287.     {$IFC NOT GENERATINGCFM}
  288.     INLINE $A91B;
  289.     {$ENDC}
  290. PROCEDURE SizeWindow(theWindow: WindowRef; w: INTEGER; h: INTEGER; fUpdate: BOOLEAN);
  291.     {$IFC NOT GENERATINGCFM}
  292.     INLINE $A91D;
  293.     {$ENDC}
  294. PROCEDURE ZoomWindow(theWindow: WindowRef; partCode: INTEGER; front: BOOLEAN);
  295.     {$IFC NOT GENERATINGCFM}
  296.     INLINE $A83A;
  297.     {$ENDC}
  298. PROCEDURE InvalRect({CONST}VAR badRect: Rect);
  299.     {$IFC NOT GENERATINGCFM}
  300.     INLINE $A928;
  301.     {$ENDC}
  302. PROCEDURE InvalRgn(badRgn: RgnHandle);
  303.     {$IFC NOT GENERATINGCFM}
  304.     INLINE $A927;
  305.     {$ENDC}
  306. PROCEDURE ValidRect({CONST}VAR goodRect: Rect);
  307.     {$IFC NOT GENERATINGCFM}
  308.     INLINE $A92A;
  309.     {$ENDC}
  310. PROCEDURE ValidRgn(goodRgn: RgnHandle);
  311.     {$IFC NOT GENERATINGCFM}
  312.     INLINE $A929;
  313.     {$ENDC}
  314. PROCEDURE BeginUpdate(theWindow: WindowRef);
  315.     {$IFC NOT GENERATINGCFM}
  316.     INLINE $A922;
  317.     {$ENDC}
  318. PROCEDURE EndUpdate(theWindow: WindowRef);
  319.     {$IFC NOT GENERATINGCFM}
  320.     INLINE $A923;
  321.     {$ENDC}
  322. PROCEDURE SetWRefCon(theWindow: WindowRef; data: LONGINT);
  323.     {$IFC NOT GENERATINGCFM}
  324.     INLINE $A918;
  325.     {$ENDC}
  326. FUNCTION GetWRefCon(theWindow: WindowRef): LONGINT;
  327.     {$IFC NOT GENERATINGCFM}
  328.     INLINE $A917;
  329.     {$ENDC}
  330. PROCEDURE SetWindowPic(theWindow: WindowRef; pic: PicHandle);
  331.     {$IFC NOT GENERATINGCFM}
  332.     INLINE $A92E;
  333.     {$ENDC}
  334. FUNCTION GetWindowPic(theWindow: WindowRef): PicHandle;
  335.     {$IFC NOT GENERATINGCFM}
  336.     INLINE $A92F;
  337.     {$ENDC}
  338. FUNCTION CheckUpdate(VAR theEvent: EventRecord): BOOLEAN;
  339.     {$IFC NOT GENERATINGCFM}
  340.     INLINE $A911;
  341.     {$ENDC}
  342. PROCEDURE ClipAbove(window: WindowRef);
  343.     {$IFC NOT GENERATINGCFM}
  344.     INLINE $A90B;
  345.     {$ENDC}
  346. PROCEDURE SaveOld(window: WindowRef);
  347.     {$IFC NOT GENERATINGCFM}
  348.     INLINE $A90E;
  349.     {$ENDC}
  350. PROCEDURE DrawNew(window: WindowRef; update: BOOLEAN);
  351.     {$IFC NOT GENERATINGCFM}
  352.     INLINE $A90F;
  353.     {$ENDC}
  354. PROCEDURE PaintOne(window: WindowRef; clobberedRgn: RgnHandle);
  355.     {$IFC NOT GENERATINGCFM}
  356.     INLINE $A90C;
  357.     {$ENDC}
  358. PROCEDURE PaintBehind(startWindow: WindowRef; clobberedRgn: RgnHandle);
  359.     {$IFC NOT GENERATINGCFM}
  360.     INLINE $A90D;
  361.     {$ENDC}
  362. PROCEDURE CalcVis(window: WindowRef);
  363.     {$IFC NOT GENERATINGCFM}
  364.     INLINE $A909;
  365.     {$ENDC}
  366. PROCEDURE CalcVisBehind(startWindow: WindowRef; clobberedRgn: RgnHandle);
  367.     {$IFC NOT GENERATINGCFM}
  368.     INLINE $A90A;
  369.     {$ENDC}
  370. FUNCTION GrowWindow(theWindow: WindowRef; startPt: Point; {CONST}VAR bBox: Rect): LONGINT;
  371.     {$IFC NOT GENERATINGCFM}
  372.     INLINE $A92B;
  373.     {$ENDC}
  374. FUNCTION FindWindow(thePoint: Point; VAR theWindow: WindowRef): INTEGER;
  375.     {$IFC NOT GENERATINGCFM}
  376.     INLINE $A92C;
  377.     {$ENDC}
  378. FUNCTION PinRect({CONST}VAR theRect: Rect; thePt: Point): LONGINT;
  379.     {$IFC NOT GENERATINGCFM}
  380.     INLINE $A94E;
  381.     {$ENDC}
  382. FUNCTION DragGrayRgn(theRgn: RgnHandle; startPt: Point; {CONST}VAR limitRect: Rect; {CONST}VAR slopRect: Rect; axis: INTEGER; actionProc: DragGrayRgnUPP): LONGINT;
  383.     {$IFC NOT GENERATINGCFM}
  384.     INLINE $A905;
  385.     {$ENDC}
  386. FUNCTION DragTheRgn(theRgn: RgnHandle; startPt: Point; {CONST}VAR limitRect: Rect; {CONST}VAR slopRect: Rect; axis: INTEGER; actionProc: DragGrayRgnUPP): LONGINT;
  387.     {$IFC NOT GENERATINGCFM}
  388.     INLINE $A926;
  389.     {$ENDC}
  390. FUNCTION TrackBox(theWindow: WindowRef; thePt: Point; partCode: INTEGER): BOOLEAN;
  391.     {$IFC NOT GENERATINGCFM}
  392.     INLINE $A83B;
  393.     {$ENDC}
  394. PROCEDURE GetCWMgrPort(VAR wMgrCPort: CGrafPtr);
  395.     {$IFC NOT GENERATINGCFM}
  396.     INLINE $AA48;
  397.     {$ENDC}
  398. PROCEDURE SetWinColor(theWindow: WindowRef; newColorTable: WCTabHandle);
  399.     {$IFC NOT GENERATINGCFM}
  400.     INLINE $AA41;
  401.     {$ENDC}
  402. PROCEDURE SetDeskCPat(deskPixPat: PixPatHandle);
  403.     {$IFC NOT GENERATINGCFM}
  404.     INLINE $AA47;
  405.     {$ENDC}
  406. FUNCTION NewCWindow(wStorage: UNIV Ptr; {CONST}VAR boundsRect: Rect; title: ConstStr255Param; visible: BOOLEAN; procID: INTEGER; behind: WindowRef; goAwayFlag: BOOLEAN; refCon: LONGINT): WindowRef;
  407.     {$IFC NOT GENERATINGCFM}
  408.     INLINE $AA45;
  409.     {$ENDC}
  410. FUNCTION GetNewCWindow(windowID: INTEGER; wStorage: UNIV Ptr; behind: WindowRef): WindowRef;
  411.     {$IFC NOT GENERATINGCFM}
  412.     INLINE $AA46;
  413.     {$ENDC}
  414. FUNCTION GetWVariant(theWindow: WindowRef): INTEGER;
  415.     {$IFC NOT GENERATINGCFM}
  416.     INLINE $A80A;
  417.     {$ENDC}
  418. PROCEDURE SetWTitle(theWindow: WindowRef; title: ConstStr255Param);
  419.     {$IFC NOT GENERATINGCFM}
  420.     INLINE $A91A;
  421.     {$ENDC}
  422. FUNCTION TrackGoAway(theWindow: WindowRef; thePt: Point): BOOLEAN;
  423.     {$IFC NOT GENERATINGCFM}
  424.     INLINE $A91E;
  425.     {$ENDC}
  426. PROCEDURE DragWindow(theWindow: WindowRef; startPt: Point; {CONST}VAR boundsRect: Rect);
  427.     {$IFC NOT GENERATINGCFM}
  428.     INLINE $A925;
  429.     {$ENDC}
  430. {$IFC NOT STRICT_WINDOWS }
  431.     
  432. TYPE
  433.     WindowPeek = ^WindowRecord;
  434.  
  435.     WindowRecord = RECORD
  436.         port:                    GrafPort;
  437.         windowKind:                INTEGER;
  438.         visible:                BOOLEAN;
  439.         hilited:                BOOLEAN;
  440.         goAwayFlag:                BOOLEAN;
  441.         spareFlag:                BOOLEAN;
  442.         strucRgn:                RgnHandle;
  443.         contRgn:                RgnHandle;
  444.         updateRgn:                RgnHandle;
  445.         windowDefProc:            Handle;
  446.         dataHandle:                Handle;
  447.         titleHandle:            StringHandle;
  448.         titleWidth:                INTEGER;
  449.         controlList:            ControlRef;
  450.         nextWindow:                WindowPeek;
  451.         windowPic:                PicHandle;
  452.         refCon:                    LONGINT;
  453.     END;
  454.  
  455.     CWindowPeek = ^CWindowRecord;
  456.  
  457.     CWindowRecord = RECORD
  458.         port:                    CGrafPort;
  459.         windowKind:                INTEGER;
  460.         visible:                BOOLEAN;
  461.         hilited:                BOOLEAN;
  462.         goAwayFlag:                BOOLEAN;
  463.         spareFlag:                BOOLEAN;
  464.         strucRgn:                RgnHandle;
  465.         contRgn:                RgnHandle;
  466.         updateRgn:                RgnHandle;
  467.         windowDefProc:            Handle;
  468.         dataHandle:                Handle;
  469.         titleHandle:            StringHandle;
  470.         titleWidth:                INTEGER;
  471.         controlList:            ControlRef;
  472.         nextWindow:                CWindowPeek;
  473.         windowPic:                PicHandle;
  474.         refCon:                    LONGINT;
  475.     END;
  476.  
  477.     WStateData = RECORD
  478.         userState:                Rect;                                    {user state}
  479.         stdState:                Rect;                                    {standard state}
  480.     END;
  481.  
  482.     WStateDataPtr = ^WStateData;
  483.     WStateDataHandle = ^WStateDataPtr;
  484.  
  485.     AuxWinPtr = ^AuxWinRec;
  486.     AuxWinHandle = ^AuxWinPtr;
  487.  
  488.     AuxWinRec = RECORD
  489.         awNext:                    AuxWinHandle;                            {handle to next AuxWinRec}
  490.         awOwner:                WindowRef;                                {ptr to window }
  491.         awCTable:                CTabHandle;                                {color table for this window}
  492.         dialogCItem:            Handle;                                    {  }
  493.         awFlags:                LONGINT;                                {reserved for expansion}
  494.         awReserved:                CTabHandle;                                {reserved for expansion}
  495.         awRefCon:                LONGINT;                                {user Constant}
  496.     END;
  497.  
  498.  
  499. FUNCTION GetAuxWin(theWindow: WindowRef; VAR awHndl: AuxWinHandle): BOOLEAN;
  500.     {$IFC NOT GENERATINGCFM}
  501.     INLINE $AA42;
  502.     {$ENDC}
  503.  
  504. CONST
  505.     wContentColor                = 0;
  506.     wFrameColor                    = 1;
  507.     wTextColor                    = 2;
  508.     wHiliteColor                = 3;
  509.     wTitleBarColor                = 4;
  510.  
  511. {$ENDC}
  512.  
  513. {$ALIGN RESET}
  514. {$POP}
  515.  
  516. {$SETC UsingIncludes := WindowsIncludes}
  517.  
  518. {$ENDC} {__WINDOWS__}
  519.  
  520. {$IFC NOT UsingIncludes}
  521.  END.
  522. {$ENDC}
  523.